package com.codegeek.project.slope.service.impl;

import com.codegeek.common.utils.DateUtils;
import com.codegeek.project.slope.domain.SlopeRepairRecord;
import com.codegeek.project.slope.mapper.SlopeRepairRecordMapper;
import com.codegeek.project.slope.service.ISlopeRepairRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 设备维修记录Service业务层处理
 *
 * @author codegeek
 * @date 2020-02-17
 */
@Service
public class SlopeRepairRecordServiceImpl implements ISlopeRepairRecordService {
    @Autowired
    private SlopeRepairRecordMapper slopeRepairRecordMapper;

    /**
     * 查询设备维修记录
     *
     * @param repairRecordId 设备维修记录ID
     * @return 设备维修记录
     */
    @Override
    public SlopeRepairRecord selectSlopeRepairRecordById(Long repairRecordId) {
        return slopeRepairRecordMapper.selectSlopeRepairRecordById(repairRecordId);
    }

    /**
     * 查询设备维修记录列表
     *
     * @param slopeRepairRecord 设备维修记录
     * @return 设备维修记录
     */
    @Override
    public List<SlopeRepairRecord> selectSlopeRepairRecordList(SlopeRepairRecord slopeRepairRecord) {
        return slopeRepairRecordMapper.selectSlopeRepairRecordList(slopeRepairRecord);
    }

    /**
     * 新增设备维修记录
     *
     * @param slopeRepairRecord 设备维修记录
     * @return 结果
     */
    @Override
    public int insertSlopeRepairRecord(SlopeRepairRecord slopeRepairRecord) {
        slopeRepairRecord.setCreateTime(DateUtils.getNowDate());
        return slopeRepairRecordMapper.insertSlopeRepairRecord(slopeRepairRecord);
    }

    /**
     * 修改设备维修记录
     *
     * @param slopeRepairRecord 设备维修记录
     * @return 结果
     */
    @Override
    public int updateSlopeRepairRecord(SlopeRepairRecord slopeRepairRecord) {
        return slopeRepairRecordMapper.updateSlopeRepairRecord(slopeRepairRecord);
    }

    /**
     * 批量删除设备维修记录
     *
     * @param repairRecordIds 需要删除的设备维修记录ID
     * @return 结果
     */
    @Override
    public int deleteSlopeRepairRecordByIds(Long[] repairRecordIds) {
        return slopeRepairRecordMapper.deleteSlopeRepairRecordByIds(repairRecordIds);
    }

    /**
     * 删除设备维修记录信息
     *
     * @param repairRecordId 设备维修记录ID
     * @return 结果
     */
    @Override
    public int deleteSlopeRepairRecordById(Long repairRecordId) {
        return slopeRepairRecordMapper.deleteSlopeRepairRecordById(repairRecordId);
    }
}
